package cn.vivi.design.simpleFactory;

import cn.vivi.design.factorymethod.AbstractFactory;
import cn.vivi.design.factorymethod.AmericanCoffeeFactory;


public class CoffeeStore {

    public Coffee orderCoffee(AbstractFactory factory) {
        Coffee coffee = factory.createCoffee();
        coffee.addMilk();
        coffee.addSugar();
        return coffee;
    }

    // Client
    public static void main(String[] args) {
        CoffeeStore coffeeStore = new CoffeeStore();
        Coffee coffee = coffeeStore.orderCoffee(new AmericanCoffeeFactory());
        System.out.println(coffee.getName());
    }
}
